﻿@{
    ViewBag.Title = "Form";
    Layout = "~/Areas/SystemManage/Views/Shared/_Form.cshtml";
}

<script>

    var keyValue = $.request("keyValue");
    //if (keyValue.length > 0) {
    //    $("#ConfigCode").prop("disabled", "disabled");
    //}
    $(function () {
        if (!!keyValue) {
            $.ajax({
                url: "/SystemManage/SysLink/GetFormJson",
                data: { keyValue: keyValue },
                dataType: "json",
                async: false,
                success: function (data) {
                    $("#form1").formSerialize(data);
                }
            });
        }
    });



    function submitForm() {
        if (!$('#form1').formValid()) {
            return false;
        }

        var Title = $("#LinkName").val();
        if (Title.length == 0) {
            $.modalMsg("友链名称不能为空");
            return false;
        }

        var LinkUrl = $("#LinkUrl").val();
        if (LinkUrl.length == 0) {
            $.modalMsg("友链网址不能为空");
            return false;
        }
        
        var data = $("#form1").formSerialize();
        $.submitForm({
            url: "/SystemManage/SysLink/SubmitForm?keyValue=" + keyValue,
            param: data,
            success: function () {
                $.currentWindow().$("#gridList").trigger("reloadGrid");
            }
        });
    }
</script>

<form id="form1">
    <div style="padding-top: 20px; margin-right: 20px;">
        <table class="form">
            <tr>
                <th class="formTitle">友链名称</th>
                <td class="formValue">
                    <input id="LinkName" name="LinkName" type="text" class="form-control" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">友链网址</th>
                <td class="formValue">
                    <input id="LinkUrl" name="LinkUrl" type="text" class="form-control" />
                </td>
            </tr>
            <tr>
                <th class="formTitle" style="vertical-align:top">备注</th>
                <td class="formValue">
                    <textarea id="Description" name="Description" class="form-control" ></textarea>
                </td>
            </tr>
            <tr>
                <th class="formTitle">排序</th>
                <td class="formValue">
                    <input id="SortCode" name="SortCode" type="text" class="form-control required" value="1" />
                </td>
            </tr>
            <tr>
                <th class="formTitle" style="height: 35px;">选项</th>
                <td class="formValue" style="padding-top: 1px;">
                    <div class="ckbox">
                        <input id="EnabledMark" name="EnabledMark" type="checkbox" checked="checked"><label for="EnabledMark">有效</label>
                    </div>
                </td>
            </tr>

        </table>
    </div>
</form>


@section Scripts{
    <!-- 配置文件 -->
    <script type="text/javascript">
      

        //var desc = $("#Description").html();
        //if (desc.length > 0) {
        //    console.log("Description初始化");
        //    ue.setContent(desc, false);
        //}

    </script>
}